<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
                      "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
    <title>Digest Authentication - Zend Framework Manual</title>

    <link href="../css/shCore.css" rel="stylesheet" type="text/css" />
    <link href="../css/shThemeDefault.css" rel="stylesheet" type="text/css" />
    <link href="../css/styles.css" media="all" rel="stylesheet" type="text/css" />
</head>
<body>
<h1>Zend Framework</h1>
<h2>Programmer's Reference Guide</h2>
<ul>
    <li><a href="../en/zend.auth.adapter.digest.html">Inglês (English)</a></li>
    <li><a href="../pt-br/zend.auth.adapter.digest.html">Português Brasileiro (Brazilian Portuguese)</a></li>
</ul>
<table width="100%">
    <tr valign="top">
        <td width="85%">
            <table width="100%">
                <tr>
                    <td width="25%" style="text-align: left;">
                    <a href="zend.auth.adapter.dbtable.html">Database Table Authentication</a>
                    </td>

                    <td width="50%" style="text-align: center;">
                        <div class="up"><span class="up"><a href="zend.auth.html">Zend_Auth</a></span><br />
                        <span class="home"><a href="manual.html">Guia de Refer&ecirc;ncia do Programador</a></span></div>
                    </td>

                    <td width="25%" style="text-align: right;">
                        <div class="next" style="text-align: right; float: right;"><a href="zend.auth.adapter.http.html">HTTP Authentication Adapter</a></div>
                    </td>
                </tr>
            </table>
<hr />
<div id="zend.auth.adapter.digest" class="section"><div class="info"><h1 class="title">Digest Authentication</h1></div>
    

    <div class="section" id="zend.auth.adapter.digest.introduction"><div class="info"><h1 class="title">Introduction</h1></div>
        

        <p class="para">
            <a href="http://en.wikipedia.org/wiki/Digest_access_authentication" class="link external">&raquo; Digest
                authentication</a> is a method of <acronym class="acronym">HTTP</acronym> authentication that
            improves upon <a href="http://en.wikipedia.org/wiki/Basic_authentication_scheme" class="link external">&raquo; Basic
                authentication</a> by providing a way to authenticate without having to
            transmit the password in clear text across the network.
        </p>

        <p class="para">
            This adapter allows authentication against text files containing lines having the basic
            elements of Digest authentication:
        </p>

        <ul class="itemizedlist">
            <li class="listitem">
                <p class="para">
                    username, such as &quot;<em class="emphasis"><var class="filename">joe.user</var></em>&quot;
                </p>
            </li>

            <li class="listitem">
                <p class="para">
                    realm, such as &quot;<em class="emphasis">Administrative Area</em>&quot;
                </p>
            </li>

            <li class="listitem">
                <p class="para">
                    <acronym class="acronym">MD5</acronym> hash of the username, realm, and password, separated
                    by colons
                </p>
            </li>
        </ul>

        <p class="para">
            The above elements are separated by colons, as in the following example (in which the
            password is &quot;<em class="emphasis">somePassword</em>&quot;):
        </p>

        <pre class="programlisting brush: txt">
someUser:Some Realm:fde17b91c3a510ecbaf7dbd37f59d4f8
</pre>

    </div>

    <div class="section" id="zend.auth.adapter.digest.specifics"><div class="info"><h1 class="title">Specifics</h1></div>
        

        <p class="para">
            The digest authentication adapter, <span class="classname">Zend_Auth_Adapter_Digest</span>,
            requires several input parameters:
        </p>

        <ul class="itemizedlist">
            <li class="listitem">
                <p class="para">
                    filename - Filename against which authentication queries are performed
                </p>
            </li>

            <li class="listitem">
                <p class="para">
                    realm - Digest authentication realm
                </p>
            </li>

            <li class="listitem">
                <p class="para">
                    username - Digest authentication user
                </p>
            </li>

            <li class="listitem">
                <p class="para">
                    password - Password for the user of the realm
                </p>
            </li>
        </ul>

        <p class="para">
            These parameters must be set prior to calling  <span class="methodname">authenticate()</span>.
        </p>
    </div>

    <div class="section" id="zend.auth.adapter.digest.identity"><div class="info"><h1 class="title">Identity</h1></div>
        

        <p class="para">
            The digest authentication adapter returns a <span class="classname">Zend_Auth_Result</span>
            object, which has been populated with the identity as an array having keys of
            <em class="emphasis">realm</em> and <em class="emphasis">username</em>. The respective array
            values associated with these keys correspond to the values set before
             <span class="methodname">authenticate()</span> is called.
        </p>

        <pre class="programlisting brush: php">
$adapter = new Zend_Auth_Adapter_Digest($filename,
                                        $realm,
                                        $username,
                                        $password);

$result = $adapter-&gt;authenticate();

$identity = $result-&gt;getIdentity();

print_r($identity);

/*
Array
(
    [realm] =&gt; Some Realm
    [username] =&gt; someUser
)
*/
</pre>

    </div>
</div>
        <hr />

            <table width="100%">
                <tr>
                    <td width="25%" style="text-align: left;">
                    <a href="zend.auth.adapter.dbtable.html">Database Table Authentication</a>
                    </td>

                    <td width="50%" style="text-align: center;">
                        <div class="up"><span class="up"><a href="zend.auth.html">Zend_Auth</a></span><br />
                        <span class="home"><a href="manual.html">Guia de Refer&ecirc;ncia do Programador</a></span></div>
                    </td>

                    <td width="25%" style="text-align: right;">
                        <div class="next" style="text-align: right; float: right;"><a href="zend.auth.adapter.http.html">HTTP Authentication Adapter</a></div>
                    </td>
                </tr>
            </table>
</td>
        <td style="font-size: smaller;" width="15%"> <style type="text/css">
#leftbar {
	float: left;
	width: 186px;
	padding: 5px;
	font-size: smaller;
}
ul.toc {
	margin: 0px 5px 5px 5px;
	padding: 0px;
}
ul.toc li {
	font-size: 85%;
	margin: 1px 0 1px 1px;
	padding: 1px 0 1px 11px;
	list-style-type: none;
	background-repeat: no-repeat;
	background-position: center left;
}
ul.toc li.header {
	font-size: 115%;
	padding: 5px 0px 5px 11px;
	border-bottom: 1px solid #cccccc;
	margin-bottom: 5px;
}
ul.toc li.active {
	font-weight: bold;
}
ul.toc li a {
	text-decoration: none;
}
ul.toc li a:hover {
	text-decoration: underline;
}
</style>
 <ul class="toc">
  <li class="header home"><a href="manual.html">Guia de Refer&ecirc;ncia do Programador</a></li>
  <li class="header up"><a href="manual.html">Guia de Refer&ecirc;ncia do Programador</a></li>
  <li class="header up"><a href="reference.html">Refer&ecirc;ncia do Zend Framework</a></li>
  <li class="header up"><a href="zend.auth.html">Zend_Auth</a></li>
  <li><a href="zend.auth.introduction.html">Introduction</a></li>
  <li><a href="zend.auth.adapter.dbtable.html">Database Table Authentication</a></li>
  <li class="active"><a href="zend.auth.adapter.digest.html">Digest Authentication</a></li>
  <li><a href="zend.auth.adapter.http.html">HTTP Authentication Adapter</a></li>
  <li><a href="zend.auth.adapter.ldap.html">LDAP Authentication</a></li>
  <li><a href="zend.auth.adapter.openid.html">Open ID Authentication</a></li>
 </ul>
 </td>
    </tr>
</table>

<script type="text/javascript" src="../js/shCore.js"></script>
<script type="text/javascript" src="../js/shAutoloader.js"></script>
<script type="text/javascript" src="../js/main.js"></script>

</body>
</html>